<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style>
    .box{
      width: 100px;
      height: 100px;
      background-color: yellow;
    }
    .green{
      background-color: green;
    }
  </style>
</head>
<body>
<div id="app">
  <input type="button" value="显示或隐藏" v-on:click="showGreenBox=!showGreenBox">
  <!--v-if是通过创建或销毁dom元素来完成元素的显示和隐藏的-->
  <div class="box green" v-if="showGreenBox">

  </div>
  <!--<div class="box" v-if="!showGreenBox"></div>-->
  <div class="box" v-else>

  </div>
</div>

<script src="js/vue.js"></script>
<script>
  var vm = new Vue({
    el:'#app',
    data:{
      showGreenBox: true
    }
  });
</script>
</body>
</html>
